//
//  Recommend.m
//  __PRODUCTNAME__
//
//  Created by Hanlingyu on 16/08/30
//  Copyright (c) ltq. All rights reserved.
//

#import "Recommend.h"
#import "Posts.h"

@implementation Recommend

- (void)setValue:(id)value forKey:(NSString *)key {
    
    if ([key isEqualToString:@"posts"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            Posts *post = [Posts modelWithDic:dic];
            [array addObject:post];
        }
        _posts = array;
    } else {
        [super setValue:value forKey:key];
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        _ID = value;
    }
    [super setValue:value forUndefinedKey:key];
    
}


+ (NSDictionary *)objectClassInArray{
    return @{@"posts" : [Posts class]};
}

@end
